
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_Hans">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Django 3.2 版本发行说明 &#8212; Django 3.2.11.dev 文档</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="next" title="Django 3.1.14 release notes" href="3.1.14.html" />
    <link rel="prev" title="Django 3.2.1 版本发行说明" href="3.2.1.html" />



 
<script src="../templatebuiltins.js"></script>
<script>
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);</script>

  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../index.html">Django 3.2.11.dev 文档</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../index.html">Home</a>  |
        <a title="Table of contents" href="../contents.html">Table of contents</a>  |
        <a title="Global index" href="../genindex.html">Index</a>  |
        <a title="Module index" href="../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="3.2.1.html" title="Django 3.2.1 版本发行说明">previous</a>
     |
    <a href="index.html" title="发行说明" accesskey="U">up</a>
   |
    <a href="3.1.14.html" title="Django 3.1.14 release notes">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="releases-3.2">
            
  <div class="section" id="s-django-3-2-release-notes">
<span id="django-3-2-release-notes"></span><h1>Django 3.2 版本发行说明<a class="headerlink" href="#django-3-2-release-notes" title="永久链接至标题">¶</a></h1>
<p><em>2021 年 4 月 6 日</em></p>
<p>欢迎来到 Django 3.2 版本！</p>
<p>这些发行说明涵盖了 <a class="reference internal" href="#whats-new-3-2"><span class="std std-ref">新功能</span></a>，以及一些 <span class="xref std std-ref">向后不兼容的变化</span>，当你从 Django 3.1 或更早版本升级时，你需要注意。我们已经 <a class="reference internal" href="#deprecated-features-3-2"><span class="std std-ref">开始了一些功能的废弃过程</span></a>。</p>
<p>如果你要更新现有的项目，请看 <a class="reference internal" href="../howto/upgrade-version.html"><span class="doc">升级 Django 到最新的版本</span></a> 指南。</p>
<p>Django 3.2 被指定为 <a class="reference internal" href="../internals/release-process.html#term-long-term-support-release"><span class="xref std std-term">长期支持发行</span></a>。它将在发行后至少三年内获得安全更新。对前一个 LTS，即 Django 2.2 的支持将于 2022 年 4 月结束。</p>
<div class="section" id="s-python-compatibility">
<span id="python-compatibility"></span><h2>Python 兼容性<a class="headerlink" href="#python-compatibility" title="永久链接至标题">¶</a></h2>
<p>Django 3.2 支持 Python 3.6、3.7、3.8、3.9 和 3.10（从 3.2.9 开始）。我们 <strong>高度推荐</strong> 并且只正式支持每个系列的最新版本。</p>
</div>
<div class="section" id="s-what-s-new-in-django-3-2">
<span id="s-whats-new-3-2"></span><span id="what-s-new-in-django-3-2"></span><span id="whats-new-3-2"></span><h2>Django 3.2 新特性<a class="headerlink" href="#what-s-new-in-django-3-2" title="永久链接至标题">¶</a></h2>
<div class="section" id="s-automatic-appconfig-discovery">
<span id="automatic-appconfig-discovery"></span><h3>自动 <a class="reference internal" href="../ref/applications.html#django.apps.AppConfig" title="django.apps.AppConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">AppConfig</span></code></a> 发现<a class="headerlink" href="#automatic-appconfig-discovery" title="永久链接至标题">¶</a></h3>
<p>大多数可插拔的应用程序在 <code class="docutils literal notranslate"><span class="pre">apps.py</span></code> 子模块中定义一个 <a class="reference internal" href="../ref/applications.html#django.apps.AppConfig" title="django.apps.AppConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">AppConfig</span></code></a> 子类。许多人在他们的 <code class="docutils literal notranslate"><span class="pre">__init__.py</span></code> 中定义了一个 <code class="docutils literal notranslate"><span class="pre">default_app_config</span></code> 的变量，指向这个类。</p>
<p>当 <code class="docutils literal notranslate"><span class="pre">apps.py</span></code> 子模块存在并定义了一个 <a class="reference internal" href="../ref/applications.html#django.apps.AppConfig" title="django.apps.AppConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">AppConfig</span></code></a> 子类时，Django 现在自动使用该配置，所以你可以删除 <code class="docutils literal notranslate"><span class="pre">default_app_config</span></code>。</p>
<p><code class="docutils literal notranslate"><span class="pre">default_app_config</span></code> 使得在 <a class="reference internal" href="../ref/settings.html#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> 中只需声明应用程序的路径（例如 <code class="docutils literal notranslate"><span class="pre">'django.contrib.admin'</span></code>）而不是应用程序配置的路径（例如 <code class="docutils literal notranslate"><span class="pre">'django.contrib.admin.apps.AdminConfig'</span></code>）。它的引入是为了向后兼容前者的风格，目的是将生态系统切换到后者，但这种切换并没有发生。</p>
<p>随着自动发现 <code class="docutils literal notranslate"><span class="pre">AppConfig</span></code>，<code class="docutils literal notranslate"><span class="pre">default_app_config</span></code> 不再需要了。因此，它被废弃了。</p>
<p>详见 <a class="reference internal" href="../ref/applications.html#configuring-applications-ref"><span class="std std-ref">配置应用程序</span></a>。</p>
</div>
<div class="section" id="s-customizing-type-of-auto-created-primary-keys">
<span id="customizing-type-of-auto-created-primary-keys"></span><h3>自定义自动创建的主键的类型<a class="headerlink" href="#customizing-type-of-auto-created-primary-keys" title="永久链接至标题">¶</a></h3>
<p>当定义一个模型时，如果模型中没有字段被定义为 <a class="reference internal" href="../ref/models/fields.html#django.db.models.Field.primary_key" title="django.db.models.Field.primary_key"><code class="xref py py-attr docutils literal notranslate"><span class="pre">primary_key=True</span></code></a>，则会添加一个隐式主键。这个隐式主键的类型现在可以通过 <a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 设置和 <a class="reference internal" href="../ref/applications.html#django.apps.AppConfig.default_auto_field" title="django.apps.AppConfig.default_auto_field"><code class="xref py py-attr docutils literal notranslate"><span class="pre">AppConfig.default_auto_field</span></code></a> 属性来控制。不再需要在所有模型中覆盖主键。</p>
<p>保持历史行为，<a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 的默认值是 <a class="reference internal" href="../ref/models/fields.html#django.db.models.AutoField" title="django.db.models.AutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">AutoField</span></code></a>。从 3.2 开始，新项目在生成时，<a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 设置为 <a class="reference internal" href="../ref/models/fields.html#django.db.models.BigAutoField" title="django.db.models.BigAutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">BigAutoField</span></code></a>。另外，新的应用程序生成时，<a class="reference internal" href="../ref/applications.html#django.apps.AppConfig.default_auto_field" title="django.apps.AppConfig.default_auto_field"><code class="xref py py-attr docutils literal notranslate"><span class="pre">AppConfig.default_auto_field</span></code></a> 设置为 <a class="reference internal" href="../ref/models/fields.html#django.db.models.BigAutoField" title="django.db.models.BigAutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">BigAutoField</span></code></a>。在未来的 Django 版本中，<a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 的默认值将被改为 <a class="reference internal" href="../ref/models/fields.html#django.db.models.BigAutoField" title="django.db.models.BigAutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">BigAutoField</span></code></a>。</p>
<p>为了避免将来不需要的迁移，要么明确设置 <a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 为 <a class="reference internal" href="../ref/models/fields.html#django.db.models.AutoField" title="django.db.models.AutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">AutoField</span></code></a> ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">DEFAULT_AUTO_FIELD</span> <span class="o">=</span> <span class="s1">&#39;django.db.models.AutoField&#39;</span>
</pre></div>
</div>
<p>或在每个应用的基础上进行配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.apps</span> <span class="kn">import</span> <span class="n">AppConfig</span>

<span class="k">class</span> <span class="nc">MyAppConfig</span><span class="p">(</span><span class="n">AppConfig</span><span class="p">):</span>
    <span class="n">default_auto_field</span> <span class="o">=</span> <span class="s1">&#39;django.db.models.AutoField&#39;</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s1">&#39;my_app&#39;</span>
</pre></div>
</div>
<p>或在每个模型的基础上：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db</span> <span class="kn">import</span> <span class="n">models</span>

<span class="k">class</span> <span class="nc">MyModel</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
    <span class="nb">id</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">AutoField</span><span class="p">(</span><span class="n">primary_key</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<p>由于预期默认值的变化，如果你没有明确设置 <a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a>，系统检查将提供一个警告。</p>
<p>当改变 <a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 的值时，目前不能生成现有的自动创建的表的主键的迁移。请参阅 <a class="reference internal" href="../ref/settings.html#std:setting-DEFAULT_AUTO_FIELD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_AUTO_FIELD</span></code></a> 文档以了解迁移此类表的详情。</p>
</div>
<div class="section" id="s-functional-indexes">
<span id="s-new-functional-indexes"></span><span id="functional-indexes"></span><span id="new-functional-indexes"></span><h3>函数索引<a class="headerlink" href="#functional-indexes" title="永久链接至标题">¶</a></h3>
<p>新的 <a class="reference internal" href="../ref/models/indexes.html#django.db.models.Index.expressions" title="django.db.models.Index.expressions"><code class="xref py py-attr docutils literal notranslate"><span class="pre">*expressions</span></code></a> 的位置参数 <a class="reference internal" href="../ref/models/indexes.html#django.db.models.Index" title="django.db.models.Index"><code class="xref py py-class docutils literal notranslate"><span class="pre">Index()</span></code></a> 能够在表达式和数据库函数上创建函数索引。例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db</span> <span class="kn">import</span> <span class="n">models</span>
<span class="kn">from</span> <span class="nn">django.db.models</span> <span class="kn">import</span> <span class="n">F</span><span class="p">,</span> <span class="n">Index</span><span class="p">,</span> <span class="n">Value</span>
<span class="kn">from</span> <span class="nn">django.db.models.functions</span> <span class="kn">import</span> <span class="n">Lower</span><span class="p">,</span> <span class="n">Upper</span>


<span class="k">class</span> <span class="nc">MyModel</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
    <span class="n">first_name</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="p">(</span><span class="n">max_length</span><span class="o">=</span><span class="mi">255</span><span class="p">)</span>
    <span class="n">last_name</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="p">(</span><span class="n">max_length</span><span class="o">=</span><span class="mi">255</span><span class="p">)</span>
    <span class="n">height</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">IntegerField</span><span class="p">()</span>
    <span class="n">weight</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">IntegerField</span><span class="p">()</span>

    <span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span>
        <span class="n">indexes</span> <span class="o">=</span> <span class="p">[</span>
            <span class="n">Index</span><span class="p">(</span>
                <span class="n">Lower</span><span class="p">(</span><span class="s1">&#39;first_name&#39;</span><span class="p">),</span>
                <span class="n">Upper</span><span class="p">(</span><span class="s1">&#39;last_name&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">desc</span><span class="p">(),</span>
                <span class="n">name</span><span class="o">=</span><span class="s1">&#39;first_last_name_idx&#39;</span><span class="p">,</span>
            <span class="p">),</span>
            <span class="n">Index</span><span class="p">(</span>
                <span class="n">F</span><span class="p">(</span><span class="s1">&#39;height&#39;</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">F</span><span class="p">(</span><span class="s1">&#39;weight&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Value</span><span class="p">(</span><span class="mi">5</span><span class="p">)),</span>
                <span class="n">name</span><span class="o">=</span><span class="s1">&#39;calc_idx&#39;</span><span class="p">,</span>
            <span class="p">),</span>
        <span class="p">]</span>
</pre></div>
</div>
<p>函数索引是使用 <a class="reference internal" href="../ref/models/options.html#django.db.models.Options.indexes" title="django.db.models.Options.indexes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Meta.indexes</span></code></a> 选项添加到模型的。</p>
</div>
<div class="section" id="s-pymemcache-support">
<span id="pymemcache-support"></span><h3><code class="docutils literal notranslate"><span class="pre">pymemcache</span></code> 支持<a class="headerlink" href="#pymemcache-support" title="永久链接至标题">¶</a></h3>
<p>新的 <code class="docutils literal notranslate"><span class="pre">django.core.cache.backends.memcached.PyMemcacheCache</span></code> 缓存后端允许使用 <a class="reference external" href="https://pypi.org/project/pymemcache/">pymemcache</a> 库操作 memcached。<code class="docutils literal notranslate"><span class="pre">pymemcache</span></code> 需要 3.4.0 或更高版本。更多细节，请参见 <a class="reference internal" href="../topics/cache.html"><span class="doc">Django 中的缓存文档</span></a>。</p>
</div>
<div class="section" id="s-new-decorators-for-the-admin-site">
<span id="new-decorators-for-the-admin-site"></span><h3>管理站点的新装饰器<a class="headerlink" href="#new-decorators-for-the-admin-site" title="永久链接至标题">¶</a></h3>
<p>新的 <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.display" title="django.contrib.admin.display"><code class="xref py py-func docutils literal notranslate"><span class="pre">display()</span></code></a> 装饰器允许轻松地为自定义显示函数添加选项，这些函数可以与 <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_display" title="django.contrib.admin.ModelAdmin.list_display"><code class="xref py py-attr docutils literal notranslate"><span class="pre">list_display</span></code></a> 或 <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.readonly_fields" title="django.contrib.admin.ModelAdmin.readonly_fields"><code class="xref py py-attr docutils literal notranslate"><span class="pre">readonly_fields</span></code></a> 一起使用。</p>
<p>同样，新的 <a class="reference internal" href="../ref/contrib/admin/actions.html#django.contrib.admin.action" title="django.contrib.admin.action"><code class="xref py py-func docutils literal notranslate"><span class="pre">action()</span></code></a> 装饰器允许轻松地将选项添加到可与 <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.actions" title="django.contrib.admin.ModelAdmin.actions"><code class="xref py py-attr docutils literal notranslate"><span class="pre">actions</span></code></a> 一起使用的动作函数。</p>
<p>使用 <code class="docutils literal notranslate"><span class="pre">&#64;display</span></code> 装饰器的好处是，现在可以在需要指定自定义方法的属性时使用 <code class="docutils literal notranslate"><span class="pre">&#64;property</span></code> 装饰器。在此之前，有必要在为方法指定所需的属性后使用 <code class="docutils literal notranslate"><span class="pre">property()</span></code> 函数来代替。</p>
<p>使用装饰器的好处是这些选项更容易被发现，因为它们可以被代码编辑器中的补全工具所提示。它们仅仅是一种方便，并且仍然在幕后的函数上设置相同的属性。</p>
</div>
<div class="section" id="s-minor-features">
<span id="minor-features"></span><h3>次要特性<a class="headerlink" href="#minor-features" title="永久链接至标题">¶</a></h3>
<div class="section" id="s-django-contrib-admin">
<span id="django-contrib-admin"></span><h4><a class="reference internal" href="../ref/contrib/admin/index.html#module-django.contrib.admin" title="django.contrib.admin: Django's admin site."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.admin</span></code></a><a class="headerlink" href="#django-contrib-admin" title="永久链接至标题">¶</a></h4>
<ul>
<li><p class="first"><a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.search_fields" title="django.contrib.admin.ModelAdmin.search_fields"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ModelAdmin.search_fields</span></code></a> 现在允许针对带空格的引号短语进行搜索。</p>
</li>
<li><p class="first">如果在管理中注册了目标模型，只读的相关字段现在被呈现为可浏览的链接。</p>
</li>
<li><p class="first">管理现在支持主题化，包括一个根据浏览器配置启用的暗色主题。更多细节见 <a class="reference internal" href="../ref/contrib/admin/index.html#admin-theming"><span class="std std-ref">主题化支持</span></a>。</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.autocomplete_fields" title="django.contrib.admin.ModelAdmin.autocomplete_fields"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ModelAdmin.autocomplete_fields</span></code></a> 现在搜索一个相关模型时尊重 <a class="reference internal" href="../ref/models/fields.html#django.db.models.ForeignKey.to_field" title="django.db.models.ForeignKey.to_field"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ForeignKey.to_field</span></code></a> 和 <a class="reference internal" href="../ref/models/fields.html#django.db.models.ForeignKey.limit_choices_to" title="django.db.models.ForeignKey.limit_choices_to"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ForeignKey.limit_choices_to</span></code></a>。</p>
</li>
<li><p class="first">管理现在安装了一个全局最终回退视图，将未经认证的用户重定向到登录页面，无论该 URL 是否有效。这可以防止潜在的模型枚举隐私问题。</p>
<p>尽管不推荐，你可以将新的 <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.final_catch_all_view" title="django.contrib.admin.AdminSite.final_catch_all_view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">AdminSite.final_catch_all_view</span></code></a> 设置为 <code class="docutils literal notranslate"><span class="pre">False</span></code> 来禁用所有视图。</p>
</li>
</ul>
</div>
<div class="section" id="s-django-contrib-auth">
<span id="django-contrib-auth"></span><h4><a class="reference internal" href="../topics/auth/index.html#module-django.contrib.auth" title="django.contrib.auth: Django's authentication framework."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.auth</span></code></a><a class="headerlink" href="#django-contrib-auth" title="永久链接至标题">¶</a></h4>
<ul>
<li><p class="first">PBKDF2 密码散列器的默认迭代次数从 216,000 次增加到 260,000 次。</p>
</li>
<li><p class="first">Argon2 密码散列器的默认变量改为 Argon2id。<code class="docutils literal notranslate"><span class="pre">memory_cost</span></code> 和 <code class="docutils literal notranslate"><span class="pre">parallelism</span></code> 分别增加到 102,400 和 8，以符合 <code class="docutils literal notranslate"><span class="pre">argon2-cffi</span></code> 的默认值。</p>
<p>增加 <code class="docutils literal notranslate"><span class="pre">memory_cost</span></code> 将所需的内存从 512KB 推到 100MB。这仍然是相当保守的，但在内存有限的环境中可能会导致问题。如果是这种情况，可以对现有的散列器进行子类化以覆盖默认值。</p>
</li>
<li><p class="first">Argon2, MD5, PBKDF2, SHA-1 密码散列器的默认盐熵从 71 位增加到 128 位。</p>
</li>
</ul>
</div>
<div class="section" id="s-django-contrib-contenttypes">
<span id="django-contrib-contenttypes"></span><h4><a class="reference internal" href="../ref/contrib/contenttypes.html#module-django.contrib.contenttypes" title="django.contrib.contenttypes: Provides generic interface to installed models."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.contenttypes</span></code></a><a class="headerlink" href="#django-contrib-contenttypes" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/contrib/contenttypes.html#django.contrib.contenttypes.forms.generic_inlineformset_factory" title="django.contrib.contenttypes.forms.generic_inlineformset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">generic_inlineformset_factory()</span></code></a> 的新参数 <code class="docutils literal notranslate"><span class="pre">absolute_max</span></code> 允许自定义提供 <code class="docutils literal notranslate"><span class="pre">POST</span></code> 数据时可以实例化的最大表单数量。更多细节请参见 <a class="reference internal" href="../topics/forms/formsets.html#formsets-absolute-max"><span class="std std-ref">Limiting the maximum number of instantiated forms</span></a>。</li>
<li><a class="reference internal" href="../ref/contrib/contenttypes.html#django.contrib.contenttypes.forms.generic_inlineformset_factory" title="django.contrib.contenttypes.forms.generic_inlineformset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">generic_inlineformset_factory()</span></code></a> 的新参数 <code class="docutils literal notranslate"><span class="pre">can_delete_extra</span></code> 允许移除删除额外表单的选项。更多信息请参见 <a class="reference internal" href="../topics/forms/formsets.html#django.forms.formsets.BaseFormSet.can_delete_extra" title="django.forms.formsets.BaseFormSet.can_delete_extra"><code class="xref py py-attr docutils literal notranslate"><span class="pre">can_delete_extra</span></code></a>。</li>
</ul>
</div>
<div class="section" id="s-django-contrib-gis">
<span id="django-contrib-gis"></span><h4><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#django-contrib-gis" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.GDALRaster.transform" title="django.contrib.gis.gdal.GDALRaster.transform"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GDALRaster.transform()</span></code></a> 方法现在支持 <a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.SpatialReference" title="django.contrib.gis.gdal.SpatialReference"><code class="xref py py-class docutils literal notranslate"><span class="pre">SpatialReference</span></code></a>。</li>
<li><a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.DataSource" title="django.contrib.gis.gdal.DataSource"><code class="xref py py-class docutils literal notranslate"><span class="pre">DataSource</span></code></a> 类现在支持 <a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">pathlib.Path</span></code></a>。</li>
<li><a class="reference internal" href="../ref/contrib/gis/layermapping.html#django.contrib.gis.utils.LayerMapping" title="django.contrib.gis.utils.LayerMapping"><code class="xref py py-class docutils literal notranslate"><span class="pre">LayerMapping</span></code></a> 类现在支持 <a class="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">pathlib.Path</span></code></a>。</li>
</ul>
</div>
<div class="section" id="s-django-contrib-postgres">
<span id="django-contrib-postgres"></span><h4><a class="reference internal" href="../ref/contrib/postgres/index.html#module-django.contrib.postgres" title="django.contrib.postgres: PostgreSQL-specific fields and features"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.postgres</span></code></a><a class="headerlink" href="#django-contrib-postgres" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <a class="reference internal" href="../ref/contrib/postgres/constraints.html#django.contrib.postgres.constraints.ExclusionConstraint.include" title="django.contrib.postgres.constraints.ExclusionConstraint.include"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ExclusionConstraint.include</span></code></a> 属性允许在 PostgreSQL 12+ 上创建覆盖排除约束。</li>
<li>新的 <a class="reference internal" href="../ref/contrib/postgres/constraints.html#django.contrib.postgres.constraints.ExclusionConstraint.opclasses" title="django.contrib.postgres.constraints.ExclusionConstraint.opclasses"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ExclusionConstraint.opclasses</span></code></a> 属性允许设置 PostgreSQL 操作符类。</li>
<li>新的 <a class="reference internal" href="../ref/contrib/postgres/aggregates.html#django.contrib.postgres.aggregates.JSONBAgg.ordering" title="django.contrib.postgres.aggregates.JSONBAgg.ordering"><code class="xref py py-attr docutils literal notranslate"><span class="pre">JSONBAgg.ordering</span></code></a> 属性决定了聚合元素的排序。</li>
<li>新的 <a class="reference internal" href="../ref/contrib/postgres/aggregates.html#django.contrib.postgres.aggregates.JSONBAgg.distinct" title="django.contrib.postgres.aggregates.JSONBAgg.distinct"><code class="xref py py-attr docutils literal notranslate"><span class="pre">JSONBAgg.distinct</span></code></a> 属性决定了聚合的值是否会是唯一的。</li>
<li><a class="reference internal" href="../ref/contrib/postgres/operations.html#django.contrib.postgres.operations.CreateExtension" title="django.contrib.postgres.operations.CreateExtension"><code class="xref py py-class docutils literal notranslate"><span class="pre">CreateExtension</span></code></a> 操作现在会检查数据库中是否已经存在扩展，如果存在则跳过迁移过程。</li>
<li>新的 <a class="reference internal" href="../ref/contrib/postgres/operations.html#django.contrib.postgres.operations.CreateCollation" title="django.contrib.postgres.operations.CreateCollation"><code class="xref py py-class docutils literal notranslate"><span class="pre">CreateCollation</span></code></a> 和 <a class="reference internal" href="../ref/contrib/postgres/operations.html#django.contrib.postgres.operations.RemoveCollation" title="django.contrib.postgres.operations.RemoveCollation"><code class="xref py py-class docutils literal notranslate"><span class="pre">RemoveCollation</span></code></a> 操作允许在 PostgreSQL 上创建和删除排序。参见 <a class="reference internal" href="../ref/contrib/postgres/operations.html#manage-postgresql-collations"><span class="std std-ref">使用迁移来管理整理</span></a> 获取更多细节。</li>
<li>对 <a class="reference internal" href="../ref/contrib/postgres/fields.html#django.contrib.postgres.fields.ArrayField" title="django.contrib.postgres.fields.ArrayField"><code class="xref py py-class docutils literal notranslate"><span class="pre">ArrayField</span></code></a> 的查找现在允许包含表达式的（非嵌套）数组作为右侧。</li>
<li>新的 <a class="reference internal" href="../ref/contrib/postgres/indexes.html#django.contrib.postgres.indexes.OpClass" title="django.contrib.postgres.indexes.OpClass"><code class="xref py py-class docutils literal notranslate"><span class="pre">OpClass()</span></code></a> 表达式允许在具有自定义运算符类的表达式上创建函数索引。参见 <a class="reference internal" href="#new-functional-indexes"><span class="std std-ref">函数索引</span></a> 获取更多细节。</li>
</ul>
</div>
<div class="section" id="s-django-contrib-sitemaps">
<span id="django-contrib-sitemaps"></span><h4><a class="reference internal" href="../ref/contrib/sitemaps.html#module-django.contrib.sitemaps" title="django.contrib.sitemaps: A framework for generating Google sitemap XML files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sitemaps</span></code></a><a class="headerlink" href="#django-contrib-sitemaps" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <a class="reference internal" href="../ref/contrib/sitemaps.html#django.contrib.sitemaps.Sitemap" title="django.contrib.sitemaps.Sitemap"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sitemap</span></code></a> 属性 <a class="reference internal" href="../ref/contrib/sitemaps.html#django.contrib.sitemaps.Sitemap.alternates" title="django.contrib.sitemaps.Sitemap.alternates"><code class="xref py py-attr docutils literal notranslate"><span class="pre">alternates</span></code></a>、<a class="reference internal" href="../ref/contrib/sitemaps.html#django.contrib.sitemaps.Sitemap.languages" title="django.contrib.sitemaps.Sitemap.languages"><code class="xref py py-attr docutils literal notranslate"><span class="pre">languages</span></code></a> 和 <a class="reference internal" href="../ref/contrib/sitemaps.html#django.contrib.sitemaps.Sitemap.x_default" title="django.contrib.sitemaps.Sitemap.x_default"><code class="xref py py-attr docutils literal notranslate"><span class="pre">x_default</span></code></a> 允许生成网站地图 <em>替换为</em> 你页面的本地化版本。</li>
</ul>
</div>
<div class="section" id="s-django-contrib-syndication">
<span id="django-contrib-syndication"></span><h4><a class="reference internal" href="../ref/contrib/syndication.html#module-django.contrib.syndication" title="django.contrib.syndication: A framework for generating syndication feeds, in RSS and Atom, quite easily."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.syndication</span></code></a><a class="headerlink" href="#django-contrib-syndication" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <code class="docutils literal notranslate"><span class="pre">item_comments</span></code> 钩子允许为每个 feed 项目指定一个评论 URL。</li>
</ul>
</div>
<div class="section" id="s-database-backends">
<span id="database-backends"></span><h4>数据库后端<a class="headerlink" href="#database-backends" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>第三方数据库后端现在可以使用新的 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.django_test_skips</span></code> 和 <code class="docutils literal notranslate"><span class="pre">django_test_expected_failures</span></code> 属性在 Django 测试套件中跳过或标记为预期失败的测试。</li>
</ul>
</div>
<div class="section" id="s-decorators">
<span id="decorators"></span><h4>装饰器<a class="headerlink" href="#decorators" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <a class="reference internal" href="../topics/http/decorators.html#django.views.decorators.common.no_append_slash" title="django.views.decorators.common.no_append_slash"><code class="xref py py-func docutils literal notranslate"><span class="pre">no_append_slash()</span></code></a> 装饰器允许个别视图从 <a class="reference internal" href="../ref/settings.html#std:setting-APPEND_SLASH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">APPEND_SLASH</span></code></a> URL 规范化中排除。</li>
</ul>
</div>
<div class="section" id="s-error-reporting">
<span id="error-reporting"></span><h4>错误报告<a class="headerlink" href="#error-reporting" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>自定义 <code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionReporter</span></code> 子类现在可以定义 <code class="xref py py-attr docutils literal notranslate"><span class="pre">html_template_path</span></code> 和 <code class="xref py py-attr docutils literal notranslate"><span class="pre">text_template_path</span></code> 属性来重写用于渲染异常报告的模板。</li>
</ul>
</div>
<div class="section" id="s-file-uploads">
<span id="file-uploads"></span><h4>文件上传<a class="headerlink" href="#file-uploads" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <a class="reference internal" href="../ref/files/uploads.html#django.core.files.uploadhandler.FileUploadHandler.upload_interrupted" title="django.core.files.uploadhandler.FileUploadHandler.upload_interrupted"><code class="xref py py-meth docutils literal notranslate"><span class="pre">FileUploadHandler.upload_interrupted()</span></code></a> 回调允许处理中断的上传。</li>
</ul>
</div>
<div class="section" id="s-forms">
<span id="forms"></span><h4>表单<a class="headerlink" href="#forms" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/forms/formsets.html#django.forms.formsets.formset_factory" title="django.forms.formsets.formset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">formset_factory()</span></code></a>、<a class="reference internal" href="../ref/forms/models.html#django.forms.models.inlineformset_factory" title="django.forms.models.inlineformset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">inlineformset_factory()</span></code></a> 和 <a class="reference internal" href="../ref/forms/models.html#django.forms.models.modelformset_factory" title="django.forms.models.modelformset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">modelformset_factory()</span></code></a> 的新 <code class="docutils literal notranslate"><span class="pre">absolute_max</span></code> 参数允许自定义提供 <code class="docutils literal notranslate"><span class="pre">POST</span></code> 数据时可实例化的最大表单数量。参见 <a class="reference internal" href="../topics/forms/formsets.html#formsets-absolute-max"><span class="std std-ref">Limiting the maximum number of instantiated forms</span></a> 以了解更多细节。</li>
<li><code class="xref py py-func docutils literal notranslate"><span class="pre">formet_factory()</span></code>、<a class="reference internal" href="../ref/forms/models.html#django.forms.models.inlineformset_factory" title="django.forms.models.inlineformset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">inlineformset_factory()</span></code></a> 和 <a class="reference internal" href="../ref/forms/models.html#django.forms.models.modelformset_factory" title="django.forms.models.modelformset_factory"><code class="xref py py-func docutils literal notranslate"><span class="pre">modelformset_factory()</span></code></a> 的新参数 <code class="docutils literal notranslate"><span class="pre">can_delete_extra</span></code> 允许删除额外的表单选项。更多信息请参见 <a class="reference internal" href="../topics/forms/formsets.html#django.forms.formsets.BaseFormSet.can_delete_extra" title="django.forms.formsets.BaseFormSet.can_delete_extra"><code class="xref py py-attr docutils literal notranslate"><span class="pre">can_delete_extra</span></code></a>。</li>
<li><a class="reference internal" href="../topics/forms/formsets.html#django.forms.formsets.BaseFormSet" title="django.forms.formsets.BaseFormSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseFormSet</span></code></a> 现在当管理表单丢失或被篡改时，会报告一个面向用户的错误，而不是引发一个异常。要自定义这个错误信息，请在实例化表单集时，将 <code class="docutils literal notranslate"><span class="pre">error_messages</span></code> 参数与 <code class="docutils literal notranslate"><span class="pre">'missing_management_form'</span></code> 键一起传递。</li>
</ul>
</div>
<div class="section" id="s-generic-views">
<span id="generic-views"></span><h4>通用视图<a class="headerlink" href="#generic-views" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/class-based-views/mixins-date-based.html#django.views.generic.dates.WeekMixin" title="django.views.generic.dates.WeekMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">WeekMixin</span></code></a> 和 <a class="reference internal" href="../ref/class-based-views/generic-date-based.html#django.views.generic.dates.WeekArchiveView" title="django.views.generic.dates.WeekArchiveView"><code class="xref py py-class docutils literal notranslate"><span class="pre">WeekArchiveView</span></code></a> 的 <code class="docutils literal notranslate"><span class="pre">week_format</span></code> 属性现在支持 <code class="docutils literal notranslate"><span class="pre">'%V'</span></code> ISO 8601 星期格式。</li>
</ul>
</div>
<div class="section" id="s-management-commands">
<span id="management-commands"></span><h4>管理命令<a class="headerlink" href="#management-commands" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-loaddata"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">loaddata</span></code></a> 现在支持存储在 XZ 档案（<cite>.xz</cite>）和 LZMA 档案（<cite>.lzma</cite>）中的固定数据。</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-dumpdata"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">dumpdata</span></code></a> 现在可以压缩 <code class="docutils literal notranslate"><span class="pre">bz2</span></code>、<code class="docutils literal notranslate"><span class="pre">gz</span></code>、<code class="docutils literal notranslate"><span class="pre">lzma</span></code> 或 <code class="docutils literal notranslate"><span class="pre">xz</span></code> 格式的数据。</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-makemigrations"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">makemigrations</span></code></a> 现在可以在没有数据库连接的情况下调用。在这种情况下，会跳过检查是否有一致的迁移历史。</li>
<li><code class="xref py py-attr docutils literal notranslate"><span class="pre">BaseCommand.required_system_checks</span></code> 现在支持指定一个标签列表。在所选标签中注册的系统检查将在执行命令前被检查出错误。在之前的版本中，所有的系统检查或者都不执行，或者都会被执行。</li>
<li>更新了对 Windows 上彩色终端输出的支持。各种现代终端环境被自动检测到，在其他情况下启用支持的选项也被改进。更多细节见 <a class="reference internal" href="../ref/django-admin.html#syntax-coloring"><span class="std std-ref">语法着色</span></a>。</li>
</ul>
</div>
<div class="section" id="s-migrations">
<span id="migrations"></span><h4>迁移<a class="headerlink" href="#migrations" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <code class="docutils literal notranslate"><span class="pre">Operation.migration_name_fragment</span></code> 属性允许提供一个文件名片段，该片段将被用来命名只包含该操作的迁移。</li>
<li>迁移现在支持从 <a class="reference external" href="https://docs.python.org/3/library/pathlib.html#module-pathlib" title="(在 Python v3.10)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code></a> 和 <a class="reference external" href="https://docs.python.org/3/library/os.html#os.PathLike" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">os.PathLike</span></code></a> 实例中序列化纯路径和具体路径对象。</li>
</ul>
</div>
<div class="section" id="s-models">
<span id="models"></span><h4>模型<a class="headerlink" href="#models" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>在 PostgreSQL 上支持 <a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.select_for_update" title="django.db.models.query.QuerySet.select_for_update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.select_for_update()</span></code></a> 的新的 <code class="docutils literal notranslate"><span class="pre">no_key</span></code> 参数，允许获得较弱的锁，不会阻止创建通过外键引用被锁定行的新行。</li>
<li><a class="reference internal" href="../ref/models/conditional-expressions.html#django.db.models.expressions.When" title="django.db.models.expressions.When"><code class="xref py py-class docutils literal notranslate"><span class="pre">When()</span></code></a> 表达式现在允许使用 <code class="docutils literal notranslate"><span class="pre">condition</span></code> 参数与 <code class="docutils literal notranslate"><span class="pre">lookups</span></code>。</li>
<li>新的 <a class="reference internal" href="../ref/models/indexes.html#django.db.models.Index.include" title="django.db.models.Index.include"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Index.include</span></code></a> 和 <a class="reference internal" href="../ref/models/constraints.html#django.db.models.UniqueConstraint.include" title="django.db.models.UniqueConstraint.include"><code class="xref py py-attr docutils literal notranslate"><span class="pre">UniqueConstraint.include</span></code></a> 属性允许在 PostgreSQL 11+ 上创建覆盖索引和覆盖唯一约束。</li>
<li>新的 <a class="reference internal" href="../ref/models/constraints.html#django.db.models.UniqueConstraint.opclasses" title="django.db.models.UniqueConstraint.opclasses"><code class="xref py py-attr docutils literal notranslate"><span class="pre">UniqueConstraint.opclasses</span></code></a> 属性允许设置 PostgreSQL 操作符类。</li>
<li><a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.update" title="django.db.models.query.QuerySet.update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.update()</span></code></a> 方法现在尊重 MySQL 和 MariaDB 的 <code class="docutils literal notranslate"><span class="pre">order_by()</span></code> 子句。</li>
<li><a class="reference internal" href="../ref/models/querysets.html#django.db.models.FilteredRelation" title="django.db.models.FilteredRelation"><code class="xref py py-class docutils literal notranslate"><span class="pre">FilteredRelation()</span></code></a> 现在支持嵌套关系。</li>
<li><a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.select_for_update" title="django.db.models.query.QuerySet.select_for_update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.select_for_update()</span></code></a> 的 <code class="docutils literal notranslate"><span class="pre">of</span></code> 参数现在于 MySQL 8.0.1+ 版本中被允许。</li>
<li><a class="reference internal" href="../ref/models/expressions.html#django.db.models.Value" title="django.db.models.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value()</span></code></a> 表达式现在会根据其提供的 <code class="docutils literal notranslate"><span class="pre">value</span></code> 的类型自动将其 <code class="docutils literal notranslate"><span class="pre">output_field</span></code> 解析为适当的 <a class="reference internal" href="../ref/models/fields.html#django.db.models.Field" title="django.db.models.Field"><code class="xref py py-class docutils literal notranslate"><span class="pre">Field</span></code></a> 子类，适用于 <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.date" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.date</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.time" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.time</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.timedelta" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.timedelta</span></code></a>、<a class="reference external" href="https://docs.python.org/3/library/decimal.html#decimal.Decimal" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">decimal.Decimal</span></code></a> 和 <a class="reference external" href="https://docs.python.org/3/library/uuid.html#uuid.UUID" title="(在 Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">uuid.UUID</span></code></a> 实例。因此，在使用 <code class="docutils literal notranslate"><span class="pre">Value()</span></code> 时，解析数据库函数和组合表达式的 <code class="docutils literal notranslate"><span class="pre">output_field</span></code> 现在可能会因混合类型而崩溃。在这种情况下，你将需要明确地设置 <code class="docutils literal notranslate"><span class="pre">output_field</span></code>。</li>
<li>新的 <a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.alias" title="django.db.models.query.QuerySet.alias"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.alias()</span></code></a> 方法允许为表达式创建可重复使用的别名，这些表达式不需要被选择，但可用于过滤、排序，或作为复杂表达式的一部分。</li>
<li>新的 <code class="xref py py-class docutils literal notranslate"><span class="pre">Collate</span></code> 函数允许通过指定的数据库排列方式进行过滤和排序。</li>
<li>如果在 <a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.distinct" title="django.db.models.query.QuerySet.distinct"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.distinct()</span></code></a> 中只指定了一个字段，<a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.in_bulk" title="django.db.models.query.QuerySet.in_bulk"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.in_bulk()</span></code></a> 的 <code class="docutils literal notranslate"><span class="pre">field_name</span></code> 参数现在可以接受不同的字段。</li>
<li><code class="xref py py-class docutils literal notranslate"><span class="pre">TruncDate</span></code> 和 <code class="xref py py-class docutils literal notranslate"><span class="pre">TruncTime</span></code> 数据库函数的新 <code class="docutils literal notranslate"><span class="pre">tzinfo</span></code> 参数允许截断特定时区的数据时间。</li>
<li>为 <a class="reference internal" href="../ref/models/fields.html#django.db.models.CharField.db_collation" title="django.db.models.CharField.db_collation"><code class="xref py py-attr docutils literal notranslate"><span class="pre">CharField</span></code></a> 和 <a class="reference internal" href="../ref/models/fields.html#django.db.models.TextField.db_collation" title="django.db.models.TextField.db_collation"><code class="xref py py-attr docutils literal notranslate"><span class="pre">TextField</span></code></a> 新增的 <code class="docutils literal notranslate"><span class="pre">db_collation</span></code> 参数允许为字段设置一个数据库排序。</li>
<li>添加了 <code class="xref py py-class docutils literal notranslate"><span class="pre">Random</span></code> 数据库函数。</li>
<li><a class="reference internal" href="../ref/models/querysets.html#aggregation-functions"><span class="std std-ref">聚合函数</span></a>、<a class="reference internal" href="../ref/models/expressions.html#django.db.models.F" title="django.db.models.F"><code class="xref py py-class docutils literal notranslate"><span class="pre">F()</span></code></a>、<a class="reference internal" href="../ref/models/expressions.html#django.db.models.OuterRef" title="django.db.models.OuterRef"><code class="xref py py-class docutils literal notranslate"><span class="pre">OuterRef()</span></code></a> 以及其他表达式现在允许使用变换。详情参见 <a class="reference internal" href="../topics/db/queries.html#using-transforms-in-expressions"><span class="std std-ref">Expressions can reference transforms</span></a>。</li>
<li><a class="reference internal" href="../topics/db/transactions.html#django.db.transaction.atomic" title="django.db.transaction.atomic"><code class="xref py py-func docutils literal notranslate"><span class="pre">atomic()</span></code></a> 的新参数 <code class="docutils literal notranslate"><span class="pre">durable</span></code> 保证在原子块中所做的更改将被提交，如果该块退出时没有错误。嵌套的原子块被标记为耐用，将引发一个 <code class="docutils literal notranslate"><span class="pre">RuntimeError</span></code>。</li>
<li>添加了 <code class="xref py py-class docutils literal notranslate"><span class="pre">JSONObject</span></code> 数据库函数。</li>
</ul>
</div>
<div class="section" id="s-pagination">
<span id="pagination"></span><h4>分页<a class="headerlink" href="#pagination" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <a class="reference internal" href="../ref/paginator.html#django.core.paginator.Paginator.get_elided_page_range" title="django.core.paginator.Paginator.get_elided_page_range"><code class="xref py py-meth docutils literal notranslate"><span class="pre">django.core.paginator.Paginator.get_elided_page_range()</span></code></a> 方法允许生成一个页面范围，其中的一些值被删除。如果有大量的页面，这对在模板中生成合理数量的页面链接很有帮助。</li>
</ul>
</div>
<div class="section" id="s-requests-and-responses">
<span id="requests-and-responses"></span><h4>请求和响应<a class="headerlink" href="#requests-and-responses" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>响应头信息现在被存储在 <a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.headers" title="django.http.HttpResponse.headers"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HttpResponse.headers</span></code></a> 中。这可以代替原来的 <code class="docutils literal notranslate"><span class="pre">HttpResponse</span></code> 对象的类似字典的接口。这两个接口将继续被支持。详情见 <a class="reference internal" href="../ref/request-response.html#setting-header-fields"><span class="std std-ref">设置头字段</span></a>。</li>
<li><a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse" title="django.http.HttpResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">HttpResponse</span></code></a>、<a class="reference internal" href="../ref/template-response.html#django.template.response.SimpleTemplateResponse" title="django.template.response.SimpleTemplateResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">SimpleTemplateResponse</span></code></a> 以及 <a class="reference internal" href="../ref/template-response.html#django.template.response.TemplateResponse" title="django.template.response.TemplateResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">TemplateResponse</span></code></a> 的新 <code class="docutils literal notranslate"><span class="pre">headers</span></code> 参数允许在实例化时设置响应的 <a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.headers" title="django.http.HttpResponse.headers"><code class="xref py py-attr docutils literal notranslate"><span class="pre">headers</span></code></a>。</li>
</ul>
</div>
<div class="section" id="s-security">
<span id="security"></span><h4>安全<a class="headerlink" href="#security" title="永久链接至标题">¶</a></h4>
<ul>
<li><p class="first"><a class="reference internal" href="../ref/settings.html#std:setting-SECRET_KEY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECRET_KEY</span></code></a> 配置现在是在第一次访问时检查有效值，而不是在第一次加载设置时。这使得运行不依赖 <code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code> 的管理命令不需要提供一个值。因此，在没有提供有效的 <code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code> 的情况下调用 <a class="reference internal" href="../topics/settings.html#django.conf.settings.configure" title="django.conf.settings.configure"><code class="xref py py-func docutils literal notranslate"><span class="pre">configure()</span></code></a>，然后继续访问 <code class="docutils literal notranslate"><span class="pre">settings.SECRET_KEY</span></code> 现在会引发一个 <a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.ImproperlyConfigured" title="django.core.exceptions.ImproperlyConfigured"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ImproperlyConfigured</span></code></a> 异常。</p>
</li>
<li><p class="first">新的 <code class="docutils literal notranslate"><span class="pre">Signer.sign_object()</span></code> 和 <code class="docutils literal notranslate"><span class="pre">Signer.unsign_object()</span></code> 方法允许签署复杂数据结构。更多细节见 <a class="reference internal" href="../topics/signing.html#signing-complex-data"><span class="std std-ref">保护复杂的数据结构</span></a>。</p>
<p>另外， <a class="reference internal" href="../topics/signing.html#django.core.signing.dumps" title="django.core.signing.dumps"><code class="xref py py-func docutils literal notranslate"><span class="pre">signing.dumps()</span></code></a> 和 <code class="xref py py-func docutils literal notranslate"><span class="pre">load()</span></code> 成为 <a class="reference internal" href="../topics/signing.html#django.core.signing.TimestampSigner.sign_object" title="django.core.signing.TimestampSigner.sign_object"><code class="xref py py-meth docutils literal notranslate"><span class="pre">TimestampSigner.sign_object()</span></code></a> 和 <a class="reference internal" href="../topics/signing.html#django.core.signing.TimestampSigner.unsign_object" title="django.core.signing.TimestampSigner.unsign_object"><code class="xref py py-meth docutils literal notranslate"><span class="pre">unsign_object()</span></code></a> 的快捷方式。</p>
</li>
</ul>
</div>
<div class="section" id="s-serialization">
<span id="serialization"></span><h4>序列化<a class="headerlink" href="#serialization" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>新的 <a class="reference internal" href="../topics/serialization.html#serialization-formats-jsonl"><span class="std std-ref">JSONL</span></a> 序列化器允许使用 JSON Lines 格式与 <a class="reference internal" href="../ref/django-admin.html#django-admin-dumpdata"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">dumpdata</span></code></a> 和 <a class="reference internal" href="../ref/django-admin.html#django-admin-loaddata"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">loaddata</span></code></a>。这对填充大型数据库很有用，因为数据是逐行加载到内存中的，而不是一次性加载。</li>
</ul>
</div>
<div class="section" id="s-signals">
<span id="signals"></span><h4>信号<a class="headerlink" href="#signals" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../topics/signals.html#django.dispatch.Signal.send_robust" title="django.dispatch.Signal.send_robust"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Signal.send_robust()</span></code></a> 现在会记录异常。</li>
</ul>
</div>
<div class="section" id="s-templates">
<span id="templates"></span><h4>模板<a class="headerlink" href="#templates" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-floatformat"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">floatformat</span></code></a> 模板过滤器现在允许使用 <code class="docutils literal notranslate"><span class="pre">g</span></code> 后缀来强制按 <a class="reference internal" href="../ref/settings.html#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a> 对活动 locale 进行分组</li>
<li>用 <a class="reference internal" href="../ref/templates/api.html#template-loaders"><span class="std std-ref">缓存的模板加载器</span></a> 缓存的模板现在可以在开发模式中正确地重新加载。</li>
</ul>
</div>
<div class="section" id="s-tests">
<span id="tests"></span><h4>测试<a class="headerlink" href="#tests" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>在 <a class="reference internal" href="../topics/testing/tools.html#django.test.TestCase.setUpTestData" title="django.test.TestCase.setUpTestData"><code class="xref py py-meth docutils literal notranslate"><span class="pre">TestCase.setUpTestData()</span></code></a> 中分配给类属性的对象现在对每个测试方法都是孤立的。这些对象现在需要支持用 <a class="reference external" href="https://docs.python.org/3/library/copy.html#copy.deepcopy" title="(在 Python v3.10)"><code class="xref py py-func docutils literal notranslate"><span class="pre">copy.deepcopy()</span></code></a> 创建深度拷贝。指定不支持 <code class="docutils literal notranslate"><span class="pre">deepcopy()</span></code> 的对象已被废弃，并将在 Django 4.1 中被移除。</li>
<li><a class="reference internal" href="../topics/testing/advanced.html#django.test.runner.DiscoverRunner" title="django.test.runner.DiscoverRunner"><code class="xref py py-class docutils literal notranslate"><span class="pre">DiscoverRunner</span></code></a> 现在默认启用 <a class="reference external" href="https://docs.python.org/3/library/faulthandler.html#module-faulthandler" title="(在 Python v3.10)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">faulthandler</span></code></a>。这可以通过使用 <a class="reference internal" href="../ref/django-admin.html#cmdoption-test-no-faulthandler"><code class="xref std std-option docutils literal notranslate"><span class="pre">test</span> <span class="pre">--no-faulthandler</span></code></a> 选项来禁用。</li>
<li><a class="reference internal" href="../topics/testing/advanced.html#django.test.runner.DiscoverRunner" title="django.test.runner.DiscoverRunner"><code class="xref py py-class docutils literal notranslate"><span class="pre">DiscoverRunner</span></code></a> 和 <a class="reference internal" href="../ref/django-admin.html#django-admin-test"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">test</span></code></a> 管理命令现在可以跟踪计时，包括数据库设置和总运行时间。这可以通过使用 <a class="reference internal" href="../ref/django-admin.html#cmdoption-test-timing"><code class="xref std std-option docutils literal notranslate"><span class="pre">test</span> <span class="pre">--timing</span></code></a> 选项来启用。</li>
<li><a class="reference internal" href="../topics/testing/tools.html#django.test.Client" title="django.test.Client"><code class="xref py py-class docutils literal notranslate"><span class="pre">Client</span></code></a> 现在在跟随 307 和 308 重定向时保留了请求的查询字符串。</li>
<li>新的 <a class="reference internal" href="../topics/testing/tools.html#django.test.TestCase.captureOnCommitCallbacks" title="django.test.TestCase.captureOnCommitCallbacks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">TestCase.captureOnCommitCallbacks()</span></code></a> 方法在一个列表中捕获传递给 <a class="reference internal" href="../topics/db/transactions.html#django.db.transaction.on_commit" title="django.db.transaction.on_commit"><code class="xref py py-func docutils literal notranslate"><span class="pre">transaction.on_commit()</span></code></a> 的回调函数。这允许你在不使用较慢的 <a class="reference internal" href="../topics/testing/tools.html#django.test.TransactionTestCase" title="django.test.TransactionTestCase"><code class="xref py py-class docutils literal notranslate"><span class="pre">TransactionTestCase</span></code></a> 的情况下测试此类回调。</li>
<li><a class="reference internal" href="../topics/testing/tools.html#django.test.TransactionTestCase.assertQuerysetEqual" title="django.test.TransactionTestCase.assertQuerysetEqual"><code class="xref py py-meth docutils literal notranslate"><span class="pre">TransactionTestCase.assertQuerysetEqual()</span></code></a> 现在支持与另一个查询集进行直接比较，而不是在使用 <code class="docutils literal notranslate"><span class="pre">transform</span></code> 参数的默认值时被限制为与对象的字符串表示列表进行比较。</li>
</ul>
</div>
<div class="section" id="s-utilities">
<span id="utilities"></span><h4>实用程序<a class="headerlink" href="#utilities" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">django.utils.timesince.timesince()</span></code> 和 <code class="docutils literal notranslate"><span class="pre">django.utils.timesince.timeuntil()</span></code> 函数的新 <code class="docutils literal notranslate"><span class="pre">depth</span></code>  参数允许指定要返回的相邻时间单位的数量。</li>
</ul>
</div>
<div class="section" id="s-validators">
<span id="validators"></span><h4>验证器<a class="headerlink" href="#validators" title="永久链接至标题">¶</a></h4>
<ul class="simple">
<li>内置的验证器现在包括提供的值在提出的 <a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.ValidationError" title="django.core.exceptions.ValidationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValidationError</span></code></a> 的 <code class="docutils literal notranslate"><span class="pre">params</span></code> 参数。这允许自定义错误信息使用 <code class="docutils literal notranslate"><span class="pre">%(value)s</span></code> 占位符。</li>
<li><a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.ValidationError" title="django.core.exceptions.ValidationError"><code class="xref py py-class docutils literal notranslate"><span class="pre">ValidationError</span></code></a> 相等运算符现在忽略了 <code class="docutils literal notranslate"><span class="pre">messages</span></code> 和 <code class="docutils literal notranslate"><span class="pre">params</span></code> 的排序。</li>
</ul>
</div>
</div>
</div>
<div class="section" id="s-backwards-incompatible-changes-in-3-2">
<span id="s-backwards-incompatible-3-2"></span><span id="backwards-incompatible-changes-in-3-2"></span><span id="backwards-incompatible-3-2"></span><h2>3.2 中向后不兼容的更改<a class="headerlink" href="#backwards-incompatible-changes-in-3-2" title="永久链接至标题">¶</a></h2>
<div class="section" id="s-database-backend-api">
<span id="database-backend-api"></span><h3>数据库后端 API<a class="headerlink" href="#database-backend-api" title="永久链接至标题">¶</a></h3>
<p>本节介绍了第三方数据库后端可能需要的更改。</p>
<ul class="simple">
<li>新的 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.introspected_field_types</span></code> 属性取代了这些特性：<ul>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_autofield</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_big_integer_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_binary_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_decimal_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_duration_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_ip_address_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_positive_integer_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_small_integer_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">can_introspect_time_field</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">introspected_big_auto_field_type</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">introspected_small_auto_field_type</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">introspected_boolean_field_type</span></code></li>
</ul>
</li>
<li>要启用对覆盖索引（<a class="reference internal" href="../ref/models/indexes.html#django.db.models.Index.include" title="django.db.models.Index.include"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Index.include</span></code></a>）和覆盖唯一约束（<a class="reference internal" href="../ref/models/constraints.html#django.db.models.UniqueConstraint.include" title="django.db.models.UniqueConstraint.include"><code class="xref py py-attr docutils literal notranslate"><span class="pre">UniqueConstraint.include</span></code></a>）的支持，设置 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.supports_covering_indexes</span></code> 为 <code class="docutils literal notranslate"><span class="pre">True</span></code>。</li>
<li>第三方数据库后端必须实现对 <code class="docutils literal notranslate"><span class="pre">CharField</span></code> 和 <code class="docutils literal notranslate"><span class="pre">TextField</span></code> 的列数据库校对的支持，或者将 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.supports_collation_on_charfield</span></code> 和 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.supports_collation_on_textfield</span></code> 设为 <code class="docutils literal notranslate"><span class="pre">False</span></code>。如果不支持非确定的排序，请将 <code class="docutils literal notranslate"><span class="pre">supports_non_deterministic_collations</span></code> 设为 <code class="docutils literal notranslate"><span class="pre">False</span></code>。</li>
<li><code class="docutils literal notranslate"><span class="pre">DatabaseOperations.random_function_sql()</span></code> 已被删除，改用新的 <code class="xref py py-class docutils literal notranslate"><span class="pre">Random</span></code> 数据库函数。</li>
<li><code class="docutils literal notranslate"><span class="pre">DatabaseOperations.date_trunc_sql()</span></code> 和 <code class="docutils literal notranslate"><span class="pre">DatabaseOperations.time_trunc_sql()</span></code> 现在接受可选的 <code class="docutils literal notranslate"><span class="pre">tzname</span></code> 参数，以便在特定的时区进行截断。</li>
<li><code class="docutils literal notranslate"><span class="pre">DatabaseClient.runshell()</span></code> 现在可以从 <code class="docutils literal notranslate"><span class="pre">DatabaseClient.settings_to_cmd_args_env()</span></code> 方法中获得参数和带有环境变量的可选字典给底层命令行客户端。第三方数据库后端必须实现 <code class="docutils literal notranslate"><span class="pre">DatabaseClient.settings_to_cmd_args_env()</span></code> 或覆盖 <code class="docutils literal notranslate"><span class="pre">DatabaseClient.runshell()</span></code>。</li>
<li>第三方数据库后端必须实现对函数索引的支持（<a class="reference internal" href="../ref/models/indexes.html#django.db.models.Index.expressions" title="django.db.models.Index.expressions"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Index.expressions</span></code></a>）或者将 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.supports_expression_indexes</span></code> 设为 <code class="docutils literal notranslate"><span class="pre">False</span></code>。如果 <code class="docutils literal notranslate"><span class="pre">COLLATE</span></code> 不是 <code class="docutils literal notranslate"><span class="pre">CREATE</span> <span class="pre">INDEX</span></code> 语句的一部分，请将 <code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.collate_as_index_expression</span></code> 设为 <code class="docutils literal notranslate"><span class="pre">True</span></code>。</li>
</ul>
</div>
<div class="section" id="s-id1">
<span id="id1"></span><h3><a class="reference internal" href="../ref/contrib/admin/index.html#module-django.contrib.admin" title="django.contrib.admin: Django's admin site."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.admin</span></code></a><a class="headerlink" href="#id1" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li>管理中的分页链接现在是 1 开头索引，而不是 0 开头索引，即第一页的查询字符串是 <code class="docutils literal notranslate"><span class="pre">?p=1</span></code>，而不是 <code class="docutils literal notranslate"><span class="pre">?p=0</span></code>。</li>
<li>新的管理全局回退视图将打破在管理 URL 之后路由并匹配管理 URL 前缀的 URL 模式。你可以调整你的 URL 排序，或者，如果有必要，将 <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.final_catch_all_view" title="django.contrib.admin.AdminSite.final_catch_all_view"><code class="xref py py-attr docutils literal notranslate"><span class="pre">AdminSite.final_catch_all_view</span></code></a> 设置为 <code class="docutils literal notranslate"><span class="pre">False</span></code>，禁用全局回退视图。更多细节见 <a class="reference internal" href="#whats-new-3-2"><span class="std std-ref">Django 3.2 新特性</span></a>。</li>
<li>最小化的 JavaScript 文件不再包括在管理中。如果你需要这些文件被最小化，请考虑使用第三方应用程序或外部构建工具。与管理一起打包的已被最小化的 JavaScript 文件（例如 <a class="reference internal" href="../ref/contrib/admin/index.html#contrib-admin-jquery"><span class="std std-ref">jquery.min.js</span></a>）仍然包括在内。</li>
<li><a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.prepopulated_fields" title="django.contrib.admin.ModelAdmin.prepopulated_fields"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ModelAdmin.prepopulated_fields</span></code></a> 不再剥离英文停顿词，例如 <code class="docutils literal notranslate"><span class="pre">'a'</span></code> 或 <code class="docutils literal notranslate"><span class="pre">'an'</span></code>。</li>
</ul>
</div>
<div class="section" id="s-id2">
<span id="id2"></span><h3><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#id2" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li>移除对 PostGIS 2.2 的支持。</li>
<li>Oracle 后端现在在调整多边形（和包含多边形的几何体集合）的方向并将其保存到数据库之前克隆它们。它们不再是可原地变更的。如果你在模型被保存后使用多边形，你可能会注意到这一点。</li>
</ul>
</div>
<div class="section" id="s-dropped-support-for-postgresql-9-5">
<span id="dropped-support-for-postgresql-9-5"></span><h3>丢弃了对 PostgreSQL 9.5 的支持<a class="headerlink" href="#dropped-support-for-postgresql-9-5" title="永久链接至标题">¶</a></h3>
<p>对 PostgreSQL 9.5 的上游支持在 2021 年 2 月结束。Django 3.2 支持 PostgreSQL 9.6 及以上版本。</p>
</div>
<div class="section" id="s-dropped-support-for-mysql-5-6">
<span id="dropped-support-for-mysql-5-6"></span><h3>丢弃了对 MySQL 5.6 的支持<a class="headerlink" href="#dropped-support-for-mysql-5-6" title="永久链接至标题">¶</a></h3>
<p>对 MySQL 5.6 的上游支持在 2021 年 4 月结束。Django 3.2 支持 MySQL 5.7 及以上版本。</p>
</div>
<div class="section" id="s-miscellaneous">
<span id="miscellaneous"></span><h3>杂项<a class="headerlink" href="#miscellaneous" title="永久链接至标题">¶</a></h3>
<ul>
<li><p class="first">Django 现在支持非 <code class="docutils literal notranslate"><span class="pre">pytz</span></code> 时区，例如 Python 3.9+ 的 <a class="reference external" href="https://docs.python.org/3/library/zoneinfo.html#module-zoneinfo" title="(在 Python v3.10)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zoneinfo</span></code></a> 模块及其向后移植版本。</p>
</li>
<li><p class="first">未记录的 <code class="docutils literal notranslate"><span class="pre">SpatiaLiteOperations.proj4_version()</span></code> 方法改名为 <code class="docutils literal notranslate"><span class="pre">proj_version()</span></code>。</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/utils.html#django.utils.text.slugify" title="django.utils.text.slugify"><code class="xref py py-func docutils literal notranslate"><span class="pre">slugify()</span></code></a> 现在可以删除前面和后面的破折号以及下划线。</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/contrib/humanize.html#std:templatefilter-intcomma"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">intcomma</span></code></a> 和 <a class="reference internal" href="../ref/contrib/humanize.html#std:templatefilter-intword"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">intword</span></code></a> 模板过滤器不再依赖于 <a class="reference internal" href="../ref/settings.html#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> 配置。</p>
</li>
<li><p class="first">移除对 <code class="docutils literal notranslate"><span class="pre">argon2-cffi</span></code> &lt; 19.1.0 的支持。</p>
</li>
<li><p class="first">当国际化被禁用（<code class="docutils literal notranslate"><span class="pre">USE_I18N</span> <span class="pre">=</span> <span class="pre">False</span></code>）和本地化被启用（<code class="docutils literal notranslate"><span class="pre">USE_L10N</span> <span class="pre">=</span> <span class="pre">True</span></code>）时，缓存键不再包括语言。在这样的配置下，升级到 Django 3.2 后，对任何以前的缓存值的第一次请求将是一次缓存丢失。</p>
</li>
<li><p class="first"><code class="docutils literal notranslate"><span class="pre">ForeignKey.validate()</span></code> 现在使用 <a class="reference internal" href="../topics/db/managers.html#django.db.models.Model._base_manager" title="django.db.models.Model._base_manager"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_base_manager</span></code></a> 而不是 <a class="reference internal" href="../topics/db/managers.html#django.db.models.Model._default_manager" title="django.db.models.Model._default_manager"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_default_manager</span></code></a> 来检查相关实例是否存在。</p>
</li>
<li><p class="first">当一个应用程序在 <code class="docutils literal notranslate"><span class="pre">apps.py</span></code> 子模块中定义了一个 <a class="reference internal" href="../ref/applications.html#django.apps.AppConfig" title="django.apps.AppConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">AppConfig</span></code></a> 子类，Django 现在会自动使用这个配置，即使它没有用 <code class="docutils literal notranslate"><span class="pre">default_app_config</span></code> 启用。如果你需要防止这种行为，请在 <a class="reference internal" href="../ref/applications.html#django.apps.AppConfig" title="django.apps.AppConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">AppConfig</span></code></a> 子类中设置 <code class="docutils literal notranslate"><span class="pre">default</span> <span class="pre">=</span> <span class="pre">False</span></code>。更多细节见 <a class="reference internal" href="#whats-new-3-2"><span class="std std-ref">Django 3.2 新特性</span></a>。</p>
</li>
<li><p class="first">实例化一个抽象模型现在会引发 <code class="docutils literal notranslate"><span class="pre">TypeError</span></code>。</p>
</li>
<li><p class="first">对 <a class="reference internal" href="../topics/testing/advanced.html#django.test.utils.setup_databases" title="django.test.utils.setup_databases"><code class="xref py py-func docutils literal notranslate"><span class="pre">setup_databases()</span></code></a> 的关键字参数现在是只能用关键字。</p>
</li>
<li><p class="first">删除了无文档的 <code class="docutils literal notranslate"><span class="pre">django.utils.http.limited_parse_qsl()</span></code> 函数。请使用 <a class="reference external" href="https://docs.python.org/3/library/urllib.parse.html#urllib.parse.parse_qsl" title="(在 Python v3.10)"><code class="xref py py-func docutils literal notranslate"><span class="pre">urllib.parse.parse_qsl()</span></code></a> 代替。</p>
</li>
<li><p class="first"><code class="docutils literal notranslate"><span class="pre">django.test.utils.TestContextDecorator</span></code> 现在使用 <a class="reference external" href="https://docs.python.org/3/library/unittest.html#unittest.TestCase.addCleanup" title="(在 Python v3.10)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">addCleanup()</span></code></a> 所以在 <a class="reference external" href="https://docs.python.org/3/library/unittest.html#unittest.TestCase.setUp" title="(在 Python v3.10)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">setUp()</span></code></a> 方法中注册的清理会在 <code class="docutils literal notranslate"><span class="pre">TestContextDecorator.disable()</span></code> 前被调用。</p>
</li>
<li><p class="first">当一个会话在并发请求中被销毁时，<code class="docutils literal notranslate"><span class="pre">SessionMiddleware</span></code> 现在会引发 <code class="xref py py-exc docutils literal notranslate"><span class="pre">SessionInterrupted</span></code> 异常，而不是 <a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.SuspiciousOperation" title="django.core.exceptions.SuspiciousOperation"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SuspiciousOperation</span></code></a>。</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/models/fields.html#django.db.models.Field" title="django.db.models.Field"><code class="xref py py-class docutils literal notranslate"><span class="pre">django.db.models.Field</span></code></a> 相等运算符现在可以正确区分跨模型的继承字段实例。此外，此类字段的排序现在也被定义了。</p>
</li>
<li><p class="first">未记录的 <code class="docutils literal notranslate"><span class="pre">django.core.files.locks.lock()</span></code> 函数现在在文件不能被锁定时返回 <code class="docutils literal notranslate"><span class="pre">False</span></code>，而不是引发 <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#BlockingIOError" title="(在 Python v3.10)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BlockingIOError</span></code></a>。</p>
</li>
<li><p class="first">密码重置机制现在在用户电子邮件改变时使令牌无效。</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/django-admin.html#django-admin-makemessages"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">makemessages</span></code></a> 命令不再处理使用 <a class="reference internal" href="../ref/django-admin.html#cmdoption-makemessages-locale"><code class="xref std std-option docutils literal notranslate"><span class="pre">makemessages</span> <span class="pre">--locale</span></code></a> 选项指定的无效 locale，如果它们包含连字符（<code class="docutils literal notranslate"><span class="pre">'-'</span></code>）。</p>
</li>
<li><p class="first"><code class="docutils literal notranslate"><span class="pre">django.contrib.auth.forms.ReadOnlyPasswordHashField</span></code> 表单字段现在默认为 <a class="reference internal" href="../ref/forms/fields.html#django.forms.Field.disabled" title="django.forms.Field.disabled"><code class="xref py py-attr docutils literal notranslate"><span class="pre">disabled</span></code></a>。因此 <code class="docutils literal notranslate"><span class="pre">UserChangeForm.clean_password()</span></code> 不再需要返回初始值。</p>
</li>
<li><p class="first"><code class="docutils literal notranslate"><span class="pre">cache.get_many()</span></code>、<code class="docutils literal notranslate"><span class="pre">get_or_set()</span></code>、<code class="docutils literal notranslate"><span class="pre">has_key()</span></code>、<code class="docutils literal notranslate"><span class="pre">incr()</span></code>、<code class="docutils literal notranslate"><span class="pre">decr()</span></code>、<code class="docutils literal notranslate"><span class="pre">incr_version()</span></code> 和 <code class="docutils literal notranslate"><span class="pre">decr_version()</span></code> 的缓存操作现在可以正确处理缓存中的 <code class="docutils literal notranslate"><span class="pre">None</span></code>，与其他值相同，而不是表现为键不存在。</p>
<p>由于 <code class="docutils literal notranslate"><span class="pre">python-memcached</span></code> 的限制，以前的行为被保留在已废弃的 <code class="docutils literal notranslate"><span class="pre">MemcachedCache</span></code> 后端。</p>
</li>
<li><p class="first">SQLite 的最小支持版本从 3.8.3 增加到 3.9.0。</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/contrib/messages.html#django.contrib.messages.storage.cookie.CookieStorage" title="django.contrib.messages.storage.cookie.CookieStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">CookieStorage</span></code></a> 现在以 <span class="target" id="index-2"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc6265.html"><strong>RFC 6265</strong></a> 兼容的格式存储信息。对使用旧格式的 cookie 的支持仍然保留到 Django 4.1。</p>
</li>
<li><p class="first"><code class="docutils literal notranslate"><span class="pre">asgiref</span></code> 的最小支持版本从 3.2.10 提高到 3.3.2。</p>
</li>
</ul>
</div>
</div>
<div class="section" id="s-features-deprecated-in-3-2">
<span id="s-deprecated-features-3-2"></span><span id="features-deprecated-in-3-2"></span><span id="deprecated-features-3-2"></span><h2>在 3.2 中被废弃的功能<a class="headerlink" href="#features-deprecated-in-3-2" title="永久链接至标题">¶</a></h2>
<div class="section" id="s-id3">
<span id="id3"></span><h3>杂项<a class="headerlink" href="#id3" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li>在 <a class="reference internal" href="../topics/testing/tools.html#django.test.TestCase.setUpTestData" title="django.test.TestCase.setUpTestData"><code class="xref py py-meth docutils literal notranslate"><span class="pre">TestCase.setUpTestData()</span></code></a> 中，将不支持用 <a class="reference external" href="https://docs.python.org/3/library/copy.html#copy.deepcopy" title="(在 Python v3.10)"><code class="xref py py-func docutils literal notranslate"><span class="pre">copy.deepcopy()</span></code></a> 创建深度拷贝的对象分配给类属性的做法已被废弃。</li>
<li>在 <a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.requires_system_checks" title="django.core.management.BaseCommand.requires_system_checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">BaseCommand.requires_system_checks</span></code></a> 中使用一个布尔值已被废弃。使用 <code class="docutils literal notranslate"><span class="pre">'__all__'</span></code> 来代替 <code class="docutils literal notranslate"><span class="pre">True</span></code>，使用 <code class="docutils literal notranslate"><span class="pre">[]</span></code>  （一个空列表）来代替 <code class="docutils literal notranslate"><span class="pre">False</span></code>。</li>
<li><a class="reference internal" href="../ref/validators.html#django.core.validators.EmailValidator" title="django.core.validators.EmailValidator"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailValidator</span></code></a> 的 <code class="docutils literal notranslate"><span class="pre">whitelist</span></code> 参数和 <code class="docutils literal notranslate"><span class="pre">domain_whitelist</span></code> 属性已被废弃。使用 <code class="docutils literal notranslate"><span class="pre">allowlist</span></code> 代替 <code class="docutils literal notranslate"><span class="pre">whitelist</span></code>，<code class="docutils literal notranslate"><span class="pre">domain_allowlist</span></code> 代替 <code class="docutils literal notranslate"><span class="pre">domain_whitelist</span></code>。你可能需要在现有的迁移中重命名 <code class="docutils literal notranslate"><span class="pre">whitelist</span></code>。</li>
<li><code class="docutils literal notranslate"><span class="pre">default_app_config</span></code> 应用程序配置变量已被废弃，因为现在自动发现了 <code class="docutils literal notranslate"><span class="pre">AppConfig</span></code>。更多细节请参见 <a class="reference internal" href="#whats-new-3-2"><span class="std std-ref">Django 3.2 新特性</span></a>。</li>
<li>在 <code class="docutils literal notranslate"><span class="pre">TransactionTestCase.assertQuerysetEqual()</span></code> 中与字符串值比较时自动调用 <code class="docutils literal notranslate"><span class="pre">repr()</span></code>，已被废弃。如果你需要以前的行为，明确设置 <code class="docutils literal notranslate"><span class="pre">transform</span></code> 为 <code class="docutils literal notranslate"><span class="pre">repr</span></code>。</li>
<li><code class="docutils literal notranslate"><span class="pre">django.core.cache.backends.memcached.MemcachedCache</span></code> 后端已被废弃，因为 <code class="docutils literal notranslate"><span class="pre">python-memcached</span></code> 有一些问题，而且似乎无人维护。使用 <code class="docutils literal notranslate"><span class="pre">django.core.cache.backends.memcached.PyMemcacheCache</span></code> 或 <code class="docutils literal notranslate"><span class="pre">django.core.cache.backends.memcached.PyLibMCCache</span></code> 代替。</li>
<li><code class="docutils literal notranslate"><span class="pre">django.contrib.messages.storage.cookie.CookieStorage</span></code> 使用的消息格式与旧版本的 Django 生成的格式不同。对旧格式的支持一直持续到 Django 4.1。</li>
</ul>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Django 3.2 版本发行说明</a><ul>
<li><a class="reference internal" href="#python-compatibility">Python 兼容性</a></li>
<li><a class="reference internal" href="#what-s-new-in-django-3-2">Django 3.2 新特性</a><ul>
<li><a class="reference internal" href="#automatic-appconfig-discovery">自动 <code class="docutils literal notranslate"><span class="pre">AppConfig</span></code> 发现</a></li>
<li><a class="reference internal" href="#customizing-type-of-auto-created-primary-keys">自定义自动创建的主键的类型</a></li>
<li><a class="reference internal" href="#functional-indexes">函数索引</a></li>
<li><a class="reference internal" href="#pymemcache-support"><code class="docutils literal notranslate"><span class="pre">pymemcache</span></code> 支持</a></li>
<li><a class="reference internal" href="#new-decorators-for-the-admin-site">管理站点的新装饰器</a></li>
<li><a class="reference internal" href="#minor-features">次要特性</a><ul>
<li><a class="reference internal" href="#django-contrib-admin"><code class="docutils literal notranslate"><span class="pre">django.contrib.admin</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-auth"><code class="docutils literal notranslate"><span class="pre">django.contrib.auth</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-contenttypes"><code class="docutils literal notranslate"><span class="pre">django.contrib.contenttypes</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-gis"><code class="docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-postgres"><code class="docutils literal notranslate"><span class="pre">django.contrib.postgres</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sitemaps"><code class="docutils literal notranslate"><span class="pre">django.contrib.sitemaps</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-syndication"><code class="docutils literal notranslate"><span class="pre">django.contrib.syndication</span></code></a></li>
<li><a class="reference internal" href="#database-backends">数据库后端</a></li>
<li><a class="reference internal" href="#decorators">装饰器</a></li>
<li><a class="reference internal" href="#error-reporting">错误报告</a></li>
<li><a class="reference internal" href="#file-uploads">文件上传</a></li>
<li><a class="reference internal" href="#forms">表单</a></li>
<li><a class="reference internal" href="#generic-views">通用视图</a></li>
<li><a class="reference internal" href="#management-commands">管理命令</a></li>
<li><a class="reference internal" href="#migrations">迁移</a></li>
<li><a class="reference internal" href="#models">模型</a></li>
<li><a class="reference internal" href="#pagination">分页</a></li>
<li><a class="reference internal" href="#requests-and-responses">请求和响应</a></li>
<li><a class="reference internal" href="#security">安全</a></li>
<li><a class="reference internal" href="#serialization">序列化</a></li>
<li><a class="reference internal" href="#signals">信号</a></li>
<li><a class="reference internal" href="#templates">模板</a></li>
<li><a class="reference internal" href="#tests">测试</a></li>
<li><a class="reference internal" href="#utilities">实用程序</a></li>
<li><a class="reference internal" href="#validators">验证器</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#backwards-incompatible-changes-in-3-2">3.2 中向后不兼容的更改</a><ul>
<li><a class="reference internal" href="#database-backend-api">数据库后端 API</a></li>
<li><a class="reference internal" href="#id1"><code class="docutils literal notranslate"><span class="pre">django.contrib.admin</span></code></a></li>
<li><a class="reference internal" href="#id2"><code class="docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#dropped-support-for-postgresql-9-5">丢弃了对 PostgreSQL 9.5 的支持</a></li>
<li><a class="reference internal" href="#dropped-support-for-mysql-5-6">丢弃了对 MySQL 5.6 的支持</a></li>
<li><a class="reference internal" href="#miscellaneous">杂项</a></li>
</ul>
</li>
<li><a class="reference internal" href="#features-deprecated-in-3-2">在 3.2 中被废弃的功能</a><ul>
<li><a class="reference internal" href="#id3">杂项</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>上一个主题</h4>
  <p class="topless"><a href="3.2.1.html"
                        title="上一章">Django 3.2.1 版本发行说明</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="3.1.14.html"
                        title="下一章">Django 3.1.14 release notes</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/releases/3.2.txt"
            rel="nofollow">显示源代码</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>快速搜索</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="转向" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">12月 07, 2021</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="3.2.1.html" title="Django 3.2.1 版本发行说明">previous</a>
     |
    <a href="index.html" title="发行说明" accesskey="U">up</a>
   |
    <a href="3.1.14.html" title="Django 3.1.14 release notes">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>